package cn.echase.ecare.yinfayun.service.impl;

import cn.echase.ecare.yinfayun.domain.entity.Building;
import cn.echase.ecare.yinfayun.service.BuildingService;
import cn.echase.ecare.yinfayun.service.ToolService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Title: IToolServiceImpl
 * @Author lidisong
 * @Package cn.echase.ecare.yinfayun.service.impl
 * @Date 08/05/2025 星期四 11:35 上午
 * @description:
 */
@Service
public class IToolServiceImpl implements ToolService {

    @Autowired
    private BuildingService buildingService;

    @Override
    public boolean isSingleBuilding() {
        //TODO 查询是否单一楼栋
//        return buildingService.isSingleBuilding();
        return false;
    }

    @Override
    public String splitBedName(String bedName, List<Object> buildingList) {
        //TODO 分隔床位名称
        if (StringUtils.isEmpty(bedName)) {
            return bedName;
        }
        if ((buildingList == null || buildingList.size() == 1) && bedName.split("-").length >= 4) {
            String[] split = bedName.split("-", 2);
            return split[1];
        } else {
            return bedName;
        }
    }

    @Override
    public List<Building> getList(Building building) {
        //TODO 建筑列表查询
        return buildingService.getList(building);
    }

}
